#include <stdio.h>
#include <stdlib.h>
#include <string.h>

int main()
{
	FILE* fp;
	char str[100];
	int n;
	while(1)
	{
		system("ps | grep mpl_all > /listen.txt");	
		system("sync");	
		sleep(1);
		memset(str,0,100);
		fp=fopen("/listen.txt","r");
		n=0;
		if(fp!=NULL)
		{	     
			while(fgets(str,100,fp)!=NULL)
				n++;			
		}
		fclose(fp);
		if(n>8)	
		{
			system("killall -2 mpl_all");
			sleep(1);
			system("killall -2 mplayer");
		}
		sleep(2);
	}

	return 0;
}
